import 'package:get/get.dart';
import 'package:shared_preferences/shared_preferences.dart';

class LaunchViewModel extends GetxController {
  final hasLogin = false.obs;

  final hasInit = false.obs;

  @override
  void onInit() {
    super.onInit();

    // BmobConfig.init(
    //     "7a699792f7d0f29f0069dc2bf5604a66", "bf11abc1ea750835b769cfdcda0c91e0",
    //     masterKey: "4a28335ef9d5daecd707f46bfc4b8d44",
    //     printError: (object, extra) {},
    //     printResponse: (object, extra) {});

    changeLoginState();
  }

  void changeLoginState() async {
    hasInit.value = false;
    SharedPreferences preferences = await SharedPreferences.getInstance();
    hasInit.value = true;
    bool hasLogin = preferences.getBool("hasLogin") ?? false;
    this.hasLogin.value = hasLogin;
  }
}
